package com.inibb.app.converter;

import java.util.ArrayList;
import java.util.List;

import com.inibb.app.po.ShoppingCart;
import com.inibb.app.vo.ShoppingCartVO;

public class ShoppingCartConvertor {
	
	public static List<ShoppingCartVO> converPOs2VOs(List<ShoppingCart> pos){
		List<ShoppingCartVO> vos = new ArrayList<ShoppingCartVO>();
		for(ShoppingCart po:pos){
			vos.add(converPO2VO(po));
		}
		return vos;
	}
	
	public static List<ShoppingCart> converVOs2POs(List<ShoppingCartVO> vos){
		List<ShoppingCart> pos = new ArrayList<ShoppingCart>();
		for(ShoppingCartVO vo:vos){
			pos.add(converVO2PO(vo));
		}
		return pos;
	}
	
	public static ShoppingCartVO converPO2VO(ShoppingCart s){
		ShoppingCartVO vo = new ShoppingCartVO();
		vo.setCartId(s.getCartId());
		vo.setCreatedDate(s.getCreatedDate());
		vo.setGoodsId(s.getGoodsId());
		vo.setQty(s.getQty());
		vo.setUpdatedDate(s.getUpdatedDate());
		vo.setUserId(s.getUserId());
		return vo;
	}
	
	public static ShoppingCart converVO2PO(ShoppingCartVO vo){
		ShoppingCart po = new ShoppingCart();
		po.setCartId(vo.getCartId());
		po.setCreatedDate(vo.getCreatedDate());
		po.setGoodsId(vo.getGoodsId());
		po.setQty(vo.getQty());
		po.setUpdatedDate(vo.getUpdatedDate());
		po.setUserId(vo.getUserId());
		return po;
	}
}
